#include <iostream>

using namespace std;

int main()
{
    string s;
    cout<<"vvedite posledovatelnost"<<endl;
    cin>>s;
    string sl;
    char a;
    for (int i=0;i<s.length();i++)
    {a=s[i];
    if ((a=='(')||(a=='{')||(a=='[')||(a=='<')||sl=="")
            sl+=a;
    else
    {
        if (sl!="")
    {
        if (((a==')') && (sl[sl.lenght()-1]=='(')) || ((a=='}') && (sl[sl.lenght()-1]=='{')) || ((a==']') && (sl[sl.lenght()-1]=='[')) || ((a=='>)') && (sl[sl.lenght()-1]=='<')))
        {
            sl.pop_back();
        }
     }
    }
if (sl=="")
        cout<<"TRUE";
else cout<<"FALSE";

    return 0;)
